package com.ruoyi.system.mapper;

import java.util.HashMap;
import java.util.List;

import com.ruoyi.system.domain.SysOrganizationDomain;
import com.ruoyi.system.domain.SysOrganizationDomainChildren;
import com.ruoyi.system.domain.SysOrganizationDomainLabel;
import com.ruoyi.system.domain.dto.SysOrganizationDomainDto;
import com.ruoyi.system.domain.vo.SysOrganizationDomainVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 组织领域Mapper接口
 *
 * @author ruoyi
 * @date 2024-08-29
 */
public interface SysOrganizationDomainMapper {
    /**
     * 查询组织领域
     *
     * @param id 组织领域主键
     * @return 组织领域
     */
    public SysOrganizationDomain selectSysOrganizationDomainById(String id);
    // 根据 parentId 查询其子节点
    List<SysOrganizationDomain> selectChildrenByParentId(String parentId);

    public List<SysOrganizationDomain> selectSysOrganizationDomainList(SysOrganizationDomain sysOrganizationDomain );


    public int insertSysOrganizationDomain(SysOrganizationDomain sysOrganizationDomain);

    /**
     * 修改组织领域
     *
     * @param sysOrganizationDomain 组织领域
     * @return 结果
     */
    public int updateSysOrganizationDomain(SysOrganizationDomain sysOrganizationDomain);

    /**
     * 删除组织领域
     *
     * @param id 组织领域主键
     * @return 结果
     */
    public int deleteSysOrganizationDomainById(String id);

    /**
     * 批量删除组织领域
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSysOrganizationDomainByIds(String[] ids);
    public int deleteSysOrganizationDomainRefByIds(String[] ids);

    List<SysOrganizationDomainVo> queryDomainList(SysOrganizationDomainDto sysOrganizationDomain);

    List<SysOrganizationDomainLabel> queryDomainLabelList(SysOrganizationDomainDto sysOrganizationDomain);
    List<SysOrganizationDomainLabel> queryDomainListByRef(@Param("userId") String userId  ,@Param("category")  String category );

    public int  deleteByParentId(String parentId);
}
/****
 *
 *    int insertChildren(@Param("dtoList") List<SysOrganizationDomainChildren> dtoList);
 *
 *     <insert id="insertChildren" parameterType="java.util.List">
 *         INSERT INTO sys_organization_domain (id, label, code, parent_id, category)
 *         VALUES
 *         <foreach collection="dtoList" item="item" separator=",">
 *             (#{item.id}, #{item.label}, #{item.code}, #{item.parentId}, #{item.category})
 *         </foreach>
 *     </insert>
 *
 */